//
//  KM_bar.m
//  kuimi
//
//  Created by guozhou-MAC001 on 15/9/14.
//  Copyright (c) 2015年 guozhou-MAC001. All rights reserved.
//

#import "KM_bar.h"
//#import "SecretViewController.h"
//#import "FriendsViewController.h"
//#import "DiaryViewController.h"
//#import "NotesViewController.h"

@interface KM_bar ()

@end

@implementation KM_bar

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSArray *vcArr=@[@"SecretViewController",@"FriendsViewController",@"NotesViewController",@"DiaryViewController",];
    NSArray *imgArr=@[@"home",@"show",@"zuji",@"Set"];
    NSArray *titleArr = @[@"秘密",@"好友",@"记录",@"我的"];
    NSMutableArray *ncArr = [NSMutableArray array];
    for (int i = 0; i<4; i++) {
        //将字符串转化成类
        Class cl = NSClassFromString(vcArr[i]);
        //父类指针指向子类对象
        UIViewController *vc = [[cl alloc] init];
        
        //放到导航里
        UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
        vc.navigationItem.title = titleArr[i];
        
        //tabBar上显示的专用按钮
        UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:titleArr[i] image:[UIImage imageNamed:imgArr[i]] tag:0];
        
        nc.tabBarItem = item;
        
        [ncArr addObject:nc];
    }
    self.viewControllers = ncArr;

    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
